package com.hdsx.restful.lzzt.rest;

import java.util.List;

import javax.annotation.Resource;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import org.springframework.stereotype.Service;

import com.hdsx.restful.lzzt.bean.Dmgzw;
import com.hdsx.restful.lzzt.service.DmgzwService;
import com.hdsx.restful.util.EasyUI;



@Path("/dmgzw")
@Service
public class DmgzwRestServer {
	@Resource(name="dmgzwServiceImpl")
	private DmgzwService server;
	
	/**
	 * http://192.168.0.137:8080/dzdt/rest/Dmgzw/list?xzqhbm=610102&Dmgzwmc=江西贝斯特企业集团&lxdh=&page=0&rows=10
	 * @param xzqhbm
	 * @param Dmgzwmc
	 * @param lxdh
	 * @param page
	 * @param rows
	 * @return
	 */
	@GET
	@Path("/list")
	@Produces(MediaType.APPLICATION_JSON)
	public EasyUI<Dmgzw> queryList(@QueryParam("xzqhbm") String xzqhbm,@QueryParam("name") String name,@QueryParam("page") int page,@QueryParam("rows") int rows){
		EasyUI<Dmgzw> easyUI=new EasyUI<Dmgzw>(page,rows);
		int count =server.queryCount(xzqhbm,name);
		List<Dmgzw> list = server.queryList(xzqhbm,name,easyUI.getBegin(),easyUI.getEnd());
		easyUI.setTotal(count);
		easyUI.setRows(list);
		return easyUI;
	}
	
	@GET
	@Path("/selectOne")
	@Produces(MediaType.APPLICATION_JSON)
	public Dmgzw selectOne(@QueryParam("id") String id){
		Dmgzw bean = server.selectOne(id);
		return bean;
	}
	
	@GET
	@Path("/auto")
	@Produces(MediaType.APPLICATION_JSON)
	public List<String> pienext(@QueryParam("name")String name){
		return server.selectName(name);
	}

}
